package jee.boot.module.bpm.dao;

import jee.boot.entity.bpm.BusinessData;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * 业务表数据
 */
@Mapper
public interface BusinessDataDao {
    /**
     * 获取单条数据
     *
     * @param entity
     * @return
     */
    @Select("${getSql}")
    Map<String,Object> get(BusinessData entity);

    /**
     * 查询数据列表
     *
     * @param entity
     * @return
     */
    @Select("<script>${findListSql} <where> ${where} </where> ${orderBySql}</script>")
    List<Map<String,Object>> findList(BusinessData entity);

    /**
     * 插入数据
     *
     * @param entity
     * @return
     */
    @Insert("${insertSql}")
    int insert(BusinessData entity);
    /**
     * 批量插入
     *
     * @param list
     */
    @Insert("<script>${list[0].batchInsertColumnsSql} <foreach collection=\"list\" item=\"entity\" separator=\",\"> (${entity.batchInsertValuesSql}) </foreach> </script>")
    public void batchInsert(@Param("list") List<BusinessData> list);
    /**
     * 更新数据
     *
     * @param entity
     * @return
     */
    @Update("${updateSql}")
    int update(BusinessData entity);
    /**
     * 删除数据
     *
     * @param entity
     * @return
     */
    @Delete("${deleteSql}")
    int delete(BusinessData entity);
    /**
     * 删除数据
     *
     * @param entity
     * @return
     */
    @Delete("${deleteByFilterSql}")
    int deleteByFilter(BusinessData entity);
}
